package com.hl.card.modular.packBack.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hl.card.modular.packBack.service.PoetryService;

@Controller
@RequestMapping("/poetryConfig")
public class PoetryController {
	private String PREFIX = "/packback/poetry/";  //前端页面路径
	@Autowired
	private PoetryService poetryService;
    @RequestMapping("")
    public String index(Model model){
    	List<String> list=poetryService.getTree();
    	model.addAttribute("goodsList", list);
        return PREFIX+"poetry.html";
    }
    /**
     * 添加功能
     */
    @RequestMapping("/poetryAdd") 
    @ResponseBody
    public Object poetryAdd(@RequestParam Map<String,String> map) {
    	try {
			poetryService.poetryAdd(map);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    	Map<String,Object> result=new HashMap<String, Object>();
		result.put("code", 200);
		result.put("message", "操作成功！");
		return result;
    }   

}
